/**
 * @file   main.cpp
 * @author Linfufu
 * @date   Sat Nov 20 09:35:14 2021
 * 
 * @brief  
 * 
 * 
 */
#include<bits/stdc++.h>
using namespace std;

class Calculator
{
private:
  struct element
  {
    double num;//定义数字
    char op;//定义操作符
    double result;//定义结果
      //const std::set<char> ValidOp={'+','-','*','/','(',')','.'};
      //const std::set<char> ValidNum={'1','2','3','4','5','6','7','8','9','0'};//建立操作符和数字的set容器
      //std::queue<element> infixqueue;//中缀
      //std::queue<element> postfixqueue;//后缀
      //std::stack<char> mystack;//堆栈
    int type;//定义数据类型，如果为0则操作符，如果为1则为数字
    
    int pri()//定义优先级
    {
      switch(op)
	{
	case'-':return 1;
	case'+':return 1;
	case'*':return 2;
	case'/':return 2;
	case'(':return 3;
	default:return 0;
	}   
    }
    
  };
    std::stack<char> mystack;//堆栈
    std::queue<element> infixqueue;//中缀
    std::queue<element> postfixqueue;//后缀
    const std::set<char> ValidOp={'+','-','*','/','(',')','.'};
    const std::set<char> ValidNum={'1','2','3','4','5','6','7','8','9','0'};//建立操作符和数字的set容器
public:
  void calculator(std::string str);
  bool is_num(char);
  bool is_op(char);
  bool is_valid(char);
  double char_to_double(char);
};

void Calculator::calculator(std::string str)//计算
{
    //int str.length();//字符串长度
  int n=str.length();
  for(int i=n-1; i>=0; i--)
    {
      char x = str.at(i);
      if(is_valid(x))
	{
	  mystack.push(x);//如果该字符为容器中的，便压入栈中
	}
    }

  int flag1 = 0;
  element temp1;
  temp1.type=1;
  temp1.num=0.0;
  while(!mystack.empty())//中缀表达
    {
      element y;      
      auto temp_a = mystack.top();
      mystack.pop();
      if(is_op( temp_a ) && temp_a != '.')
	{
	  y.type=0;
	  y.op= temp_a;
	  infixqueue.push(y);//若为操作符，则插入队列
	  if( temp_a == '(')
	    {
	      flag1++;
	    }
	  if( temp_a == ')')
	    {
	      flag1--;
	    }
	  if( flag1<0 )
	    {
	      cout<< "Error" <<endl;//若flag1小于0,说明存在一个‘)'没有对应的左括号，则出错
	      return;
	    }
	}
      else if( is_num(temp_a) )
	{
	  double num = char_to_double( temp_a );
	  int flag2=0;
	  double k=1.0;
	  
	  while(!mystack.empty())//将小数插入
	    {
	      auto temp_b = mystack.top();
	      mystack.pop();
	      if( is_op(temp_b) && temp_b != '.')
		{
		  mystack.push( temp_b );
		  break;
		}
	      else if( temp_b=='.' )
		{
		  flag2++;
		  
		}
	      else if( is_num( temp_b ))
		{
		  if( flag2==0 )
		    {
		      num = num*10 + char_to_double( temp_b );
		    }
		  else
		    {
		      num = num + char_to_double( temp_b ) * pow(0.1,k);
		    }
		  k++;
		}
	    }
	  if( flag2 > 1)//俩小数点显然错误，故出错
	    {
	      cout<< "Error" <<endl;
	      return;
	    }
	  y.num = num;
	  y.type = 1;
	  infixqueue.push(y);
	}
    }
  if( flag1 != 0 )//若flag1不等于0,则左右括号数量不匹配，故会出错
    {
      cout<< "Error" <<endl;
      return;
    }


  stack<element> container;//建立一个容器
  while(!infixqueue.empty())//由中缀表达转化为后缀表达
    {
      element temp2 = infixqueue.front();
      infixqueue.pop();
      if(temp2.type == 1)//数字直接输出
	{
	  postfixqueue.push(temp2);
	}
      else if( temp2.type == 0 && temp2.op != ')' )
	{
	  while( !container.empty() )//当容器内新push的操作符优先级低于或者等于原先容器内最上面的操作符的优先级，则输出优先级高的这个操作符
	    {
	      auto m = container.top();
	      if( m.pri() <= temp2.pri() || temp2.op == '(' )
		break;
	      postfixqueue.push(m);
	      container.pop();
	    }
	  container.push(temp2);
	}
      else if( temp2.op == ')' )//输出括号内的操作符
	{
	  while( container.top().op != '(' )
	    {
	      auto m = container.top();
	      postfixqueue.push(m);
	      container.pop();
	    }
	  container.pop();
	}
    }
  
  while( !container.empty())//输出容器内剩余的操作符
    {
      auto m = container.top();
      postfixqueue.push(m);
      container.pop();
    }


  stack<element> calstack;
  element result;
  double p,q;
  result.type = 1;
  while( !postfixqueue.empty())
    {
      auto temp = postfixqueue.front();
      postfixqueue.pop();
      if( temp.type == 1)
	{
	  calstack.push(temp);
	}
      else
	{
	  switch( temp.op)//定义四则运算
	    {
	    case'+':p = calstack.top().num;calstack.pop();q = calstack.top().num;calstack.pop();result.num = q+p;calstack.push(result);break;
	    case'-':p = calstack.top().num;calstack.pop();q = calstack.top().num;calstack.pop();result.num = q-p;calstack.push(result);break;
	    case'*':p = calstack.top().num;calstack.pop();q = calstack.top().num;calstack.pop();result.num = q*p;calstack.push(result);break;
	    case'/':p = calstack.top().num;calstack.pop();q = calstack.top().num;calstack.pop();result.num = q/p;calstack.push(result);break;
            default:break;
	    }
	}
    }
  cout<<calstack.top().num<<endl;
}

double Calculator::char_to_double(char b)//将字符类型转化为双精度类型
{
  double z = (double)( int(b) - 48);
  return z;
}


bool Calculator::is_valid(char b)//判断是否为操作符或者数字
{
  return (is_num(b)||is_op(b));
}

bool Calculator::is_num(char b)//判断是否为容器中的数字
{
  if(std::find (ValidNum.begin(), ValidNum.end(), b) == ValidNum.end())
    {
      return false;
    }
  else
    return true;
}

bool Calculator::is_op(char b)//判断是否为操作符
{
  if(std::find (ValidOp.begin(), ValidOp.end(), b) == ValidOp.end())
    {
      return false;
    }
  else
    return true;
}


int main(int argc,char* agrv[])
{
  std::string str;
  std::cin >> str;
  //Calculator calculator(str);
  Calculator c;
  c.calculator(str);
  
}
